<template>
	<view class="mmisson-fire">
		<view class="misson-option" v-for="(item,index) in listData" :key="index">
			<view class="option-center">
				<view class="cen_png">
					<view class="option-png">
						<image :src="item.imgSrc" mode=""></image>
					</view>
				</view>
				<view class="optin-words">{{item.name}}</view>
				<view class="optin-smallword">{{item.num}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'UniModuleIndex',
		props: {
			moduleDatas: {
				type: Array,
				default: function() {
					return [];
				}
			},
			// 1.工程维护 2 工程档案
			type: {
				type: String,
				default: "1"
			},
		},
		watch: {
			moduleDatas: {
				handler(list1, list2) {
					this.listData = list1;
					this.checkPropery();
				},
				immediate: true
			}
		},
		data() {
			return {
				listData: [],
				/**
				 * 数据格式
				 * 
				moduleDatas: [{
						"name": "未完成任务",
						"num": "10"
					}]*/

			}
		},
		methods: {
			/*
			 *传递动态图片src
			 */
			checkPropery() {
				this.listData.forEach((ele, index) => {
					//1.在终端进行测试不支持 图片名称为中文
					var name = (this.type == "1" ? "gcwh_" + (index + 1) : "gcda_" + (index + 1));
					ele.imgSrc = "../../static/images/" + name + ".png";
				})
			},
		},
		onLoad: function() {}
	}
</script>

<style>
	.mmisson-fire {
		width: 94%;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.misson-option {
		width: 49%;
		height: 130px;
		background-color: #ffffff;
		border-radius: 3px;
		margin-top: 14px;
		position: relative;
	}

	.option-center {
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		margin: auto;
	}

	.cen_png {
		width: 100%;
		height: 30px;
		display: flex;
		justify-content: center;
		margin-top: 28px;
	}

	.option-png {
		width: 33px;
		height: 34px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.option-png image {
		max-width: 100%;
		max-height: 100%;
	}

	.optin-words {
		width: 100%;
		color: #666666;
		text-align: center;
		font-size: 15px;
		margin-top: 7px;
	}

	.optin-smallword {
		width: 100%;
		text-align: center;
		font-size: 16px;
		color: #84bff8;
	}
</style>
